PGTracer
          Un outil de tracing spécialisé pour PostgreSQL
        
        
        
          Un sondage !
          Combien d'entre vous ont utilisé ...
          
            pg_stat_statements 
            log_min_duration_statement 
            auto_explain 
            perf 
          
        
        
        
           Reconstitution d'un plan: exemple (1/4)
          
            
          
postgres=# explain (analyze, buffers) select * from t1 join t2 on t1.a = t2.a; 
                                                         QUERY PLAN                                                         
----------------------------------------------------------------------------------------------------------------------------
 Nested Loop  (cost=0.43..64.78 rows=1997 width=21) (actual time=0.038..0.039 rows=0 loops=1)
   Buffers: shared hit=7
   ->  Seq Scan on t1  (cost=0.00..1.02 rows=2 width=8) (actual time=0.006..0.007 rows=2 loops=1)
         Buffers: shared hit=1
   ->  Index Only Scan using t2_a_idx on t2  (cost=0.43..21.90 rows=998 width=13) (actual time=0.008..0.008 rows=0 loops=2)
         Index Cond: (a = t1.a)
         Heap Fetches: 0
         Buffers: shared hit=6
 Planning:
   Buffers: shared hit=12
 Planning Time: 0.337 ms
 Execution Time: 0.141 ms
(12 rows)
            
            
           
        
        
           Reconstitution d'un plan: exemple (2/4)
          
          ExecProcNodeFirst Arg1: 0x560b6eb184b8
ExecutePlan
standard_ExecutorRun Arg1: 0x560b6eb28418
ExplainOnePlan Arg1: 0x560b6eb184b8
ExplainOneQuery Arg1: 0x560b6eb184b8
ExplainQuery Arg1: 0x560b6eb184b8
standard_ProcessUtility Arg1: 0x560b6ea5c138
ProcessUtility Arg1: 0x7fffcb4f4350
PortalRunUtility Arg1: 0x560b6eaa16a0
FillPortalStore Arg1: 0x560b6eaa16a0
PortalRun Arg1: 0x560b6eaa16a0
exec_simple_query Arg1: 0x560b6eb184b8
PostgresMain Arg1: 0x560b6eb184b8
          
          
          
          
 NestLoop (@0x560b6eb184b8)
          
          
        
        
           Reconstitution d'un plan: exemple (3/4)
          
          ExecProcNodeFirst Arg1: 0x560b6eb18690
ExecProcNode Arg1: 0x560b6eb18690
ExecNestLoop Arg1: 0x560b6eb18690
ExecProcNodeInstr Arg1: 0x560b6eb184b8
ExecutePlan
standard_ExecutorRun Arg1: 0x560b6eb28418
ExplainOnePlan Arg1: 0x560b6eb18690
ExplainOneQuery Arg1: 0x560b6eb18690
...
          
          
          
          
SeqScan (@0x560b6eb18690) (cost=0.00..1.02 rows=2 width=8) (actual time=0.000...0.000 rows=0 loops=0)
          
          
          
          
NestLoop (@0x560b6eb184b8) (cost=0.43..64.78 rows=1997 width=21) (actual time=0.000...0.000 rows=0 loops=0)
        -> SeqScan (@0x560b6eb18690) (cost=0.00..1.02 rows=2 width=8) (actual time=0.000...0.000 rows=0 loops=0)
          
          
        
        
           Rebuilding execution plans: exemple (3/4)
          Et enfin, on reconstruit l'ensemble...
          
          
NestLoop (cost=0.43..64.78 rows=1997 width=21) (actual time=0.033...0.034 rows=0 loops=1)
        Buffers: shared_blks_hit=7
        -> SeqScan (cost=0.00..1.02 rows=2 width=8) (actual time=0.005...0.006 rows=2 loops=1)
                Buffers: shared_blks_hit=1
        -> IndexOnlyScan (cost=0.43..21.90 rows=998 width=13) (actual time=0.004...0.004 rows=0 loops=2)
                Buffers: shared_blks_hit=6